package com.dg.cuckoo.admin.action.acceptance;

import com.dg.cuckoo.admin.dto.acceptance.AcceptanceDto;
import com.dg.cuckoo.admin.service.AcceptanceService;
import com.dg.cuckoo.common.utils.PageModel;
import com.dg.cuckoo.core.BaseController;
import com.dg.cuckoo.core.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 项目受理-项目受理
 */
@RestController
@RequestMapping("/acceptance/acceptance")
public class Acceptance extends BaseController {

    @Autowired
    private AcceptanceService service;

    /**
     * 新增
     */
    @PostMapping("save")
    public JsonResult<Void> save(AcceptanceDto dto){
        service.save(dto);
        return new JsonResult<>(OK);
    }

    /**
     * 删除
     */
    @PostMapping("delect/{id}")
    public JsonResult<Void> delect(@PathVariable String id){
        service.delect(id);
        return new JsonResult<>();
    }

    /**
     * 分页
     * @param page 页
     * @param pageSize 页数
     * @return
     */
    @PostMapping("page/{page}/{pageSize}")
    public JsonResult<PageModel> page(@PathVariable Integer page,@PathVariable Integer pageSize){
        PageModel data = service.page(page, pageSize);
        return new JsonResult<>(OK,data);
    }

    /**
     * 修改
     */
    @PostMapping("update")
    public JsonResult<Void> update(String id,AcceptanceDto dto){
        service.update(id,dto);
        return new JsonResult<>(OK);
    }

    /**
     * 点击查询信息
     */
    @PostMapping("openInfo/{id}")
    public JsonResult<String> openInfo(@PathVariable String id){
        String data = service.openInfo(id);
        return new JsonResult<>(OK,data);
    }

    /**
     * 搜索栏用基础资料项目详细的接口
     */

}
